﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Tesla.DataAccess.DataAccessLogic.Implementations;
using Tesla.Util.Utilities;
using Tesla.Service.DataContracts;
using Tesla.DataAccess.DataAccessLogic.Interfaces;
using Tesla.Business.BusinessLogic.Interfaces;
using System.Transactions;


namespace Tesla.Business.BusinessLogic.Implementations
{
    public class TimeSheetBL : BaseOperationalBL, ITimeSheetBL
    {
        public IList<BaseDC> ReadTasksForTimeSheet(int ProjectID, int FinYr, int EmpID)
        {
            IList<BaseDC> timesheet = null;

            try
            {
                using (ContextDA cDA = new ContextDA())
                {
                    ITimeSheetDA idaTS = cDA.CreateSpecializedDA(EntityMapper.TIMESHEETDA) as ITimeSheetDA;
                    timesheet = idaTS.ReadTasksForTimeSheet(ProjectID, FinYr, EmpID);
                }
                return timesheet;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public IList<BaseDC> ReadWeeksCalendar(int ProjectID, int FinYr, DateTime refdate)
        {
            IList<BaseDC> days = null;

            try
            {
                using (ContextDA cDA = new ContextDA())
                {
                    ITimeSheetDA idaTS = cDA.CreateSpecializedDA(EntityMapper.TIMESHEETDA) as ITimeSheetDA;
                    days = idaTS.ReadWeeksCalendar(ProjectID, FinYr, refdate);
                }
                return days;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
